nyufile = fullfile('nyu_depth_v2_labeled.mat');
outDir = fullfile('output/', 'sgupta', 'datasets', 'nyud2', 'datacopy');
mkdir(fullfile(outDir, 'rawdepth'));
mkdir(fullfile(outDir, 'depth'));
mkdir(fullfile(outDir, 'images'));


% dt = load(nyufile, 'rawDepths');
% for i = 1:1449, 
%   imwrite(uint16((dt.rawDepths(:,:,i))*1000), fullfile(outDir, 'rawdepth', sprintf('img_%04d.png', i + 5000))); 
% end

dt = load(nyufile, 'depths');
for i = 1:1449, 
  imwrite(uint16((dt.depths(:,:,i))*1000), fullfile(outDir, 'depth', sprintf('img_%04d.png', i + 5000))); 
end

% dt = load(nyufile, 'images');
% for i = 1:1449, 
%   imwrite(uint8((dt.images(:,:,:,i))), fullfile(outDir, 'images', sprintf('img_%04d.png', i + 5000))); 
% end